
package com.tools.cleanmaster.ui.card;

/**
 * Created by lianzhan on 15/10/29.
 */
public enum CardType {

    TRASH("trash"),

    RATE("rate"),

    AD("ad"),

    LOADING_AD("loading_ad"),

    PHONE_MEDIA("phone_media"),

    CHARGING("charging"),

    AUTO_CLEAN("auto_clean"),

    SWIPE("swipe"),

    COOLER("cooler"),

    POWER("power"),

    BOOSTER("booster");

    /**
     * 云端配置具体卡片位置及可见性的key
     */
    public String key;

    CardType(String key) {
        this.key = key;
    }

    /**
     * 根据key获取卡片类型的enum
     *
     * @param key 卡片类型定义的key
     */
    public static CardType getType(String key) {
        CardType[] cardType = CardType.values();
        for (int i = 0; i < cardType.length; i++) {
            if (cardType[i].key.equals(key)) {
                return cardType[i];
            }
        }
        return null;
    }

}
